package com.gdit.zax.thread;

import java.io.File;

import com.gdit.zax.utils.LogUtil;

public class DeleteFileThread extends Thread {
	private long waittime;
	private File delfile;
	
	public DeleteFileThread(File file,long waittime) {
		this.delfile = file;
		this.waittime = waittime;
	}
	
	@Override
	public void run() {
		try {
			sleep(waittime);
			if (delfile.isDirectory()) {
				File[] files = delfile.listFiles();
				for (File subfile : files) {
					LogUtil.print("删除上传的文件:" + subfile.getAbsolutePath());
					subfile.delete();
				}
			} else {
				LogUtil.print("删除上传的文件:" + delfile.getAbsolutePath());
				delfile.delete();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	
}
